<template>
<div class="myBox">
  <div class="myTitle">
<span class="mySpan">商城信息配置</span>
  </div>
  <div class="myBox2">
<el-form ref="form" :model="form" label-width="100px" class="myform">
  <el-form-item   label="商城名称"  prop='shopping_mall_name'>
    <el-input v-model="form.shopping_mall_name" class="myinput"></el-input>
  </el-form-item>

  <el-form-item  label="商城地址"  prop='shopping_mall_address'>
    <el-input v-model="form.shopping_mall_address"  class="myinput"></el-input>
  </el-form-item>

  <el-form-item   label="联系电话"  prop='shopping_mall_phone'>
    <el-input v-model="form.shopping_mall_phone"  class="myinput"></el-input>
  </el-form-item>

  <el-form-item   label="联系QQ"  prop='shopping_mall_qq'>
    <el-input v-model="form.shopping_mall_qq"  class="myinput"></el-input>
  </el-form-item>
   </el-form>
  </div>
<div class="myfooder">
        <el-button type="primary" @click="editData">确定</el-button>
        <el-button class="myRight">取消</el-button>
</div>



</div>
 
</template>
  
<script>
import axios from 'axios'
export default {
  name: 'shopMallInfoConfig',
  componentTitle: '商城信息配置',
  data () {
    return {
      token:sessionStorage.getItem('Shopping-Admin-Token'),
      form :{
        shopping_mall_address:'',
        shopping_mall_name:'',
        shopping_mall_qq:'',
        shopping_mall_phone:'',
      },
    }
  },
  mounted () {
    this.getData()
  },
  methods:{
 
    editData () {
      axios({
        url: 'http://192.168.200.251:8888/admin/config/mall',
        method: 'post',
        data: {
          ...this.form
        },
        headers: {
          'Shopping-Admin-Token': sessionStorage.getItem('Shopping-Admin-Token')
        }
      }).then(res => {
        if (res.data.errno === 0) {

          this.$notify.success({title: '成功',message:'商场配置'+res.data.errmsg})

          this.getData()

        } else {
          this.$notify.error({title: '失败',message:res.data.errmsg})
        }
      })
    },

    getData () {
     axios({
        url: 'http://192.168.200.251:8888/admin/config/mall',
        method: 'get',
        params: {
    
        },
        headers: {
          'Shopping-Admin-Token': sessionStorage.getItem('Shopping-Admin-Token')
        }
      }).then(res => {
        this.form = res.data.data
        console.log(res.data.data)
      })
    },
},
  
}
</script>


<style lang="scss" scoped>

.myBox{
  width: 95%;
  height: 405px;
  background-color: rgb(255, 255, 255);
  margin: 0 auto;
  margin-top: 30px;
   box-shadow: 0px 0px 8px rgb(160, 160, 160);

}

.myTitle{
  height: 55px;
  background-color: rgb(255, 255, 255);
  margin: 0 auto;
  border-bottom: #ddd 1px solid;

  .mySpan{
    line-height: 55px;
    margin-left: 25px;
  }
}

.myBox2{
   display:flex;
   justify-content: center;
}

.myform{
  
  margin-top: 20px;

  .myinput{
    width: 735px;
  }
}


.myfooder{
 width: 100%;
  height: 36px;
text-align: right;

  .myRight{
margin-right: 20px;
  }
}



</style>